< previous page page_198 next page >

Page 198
bottom of the main form. You can still do this by using the statusbar control and the MouseMove event of the objects on the form. However, using this method of displaying information requires you to add code to almost every object's MouseMove event. To see how this would work, start a new project and place a status bar at the bottom of the form. When you do this, you automatically get one panel set as a text panel. Now, add two command buttons to the form. This will give you enough objects to work with for this example. Now add the following code to your form:
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, x_
   As Single, y As Single)
    StatusBar1.Panels(1).Text = This command button will perform task 1
End Sub

Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, x_
   As Single, Y As Single)
    StatusBar1.Panels(1).Text = This command button will perform task 2

End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As_
   Single, y As Single)
    StatusBar1.Panels(1).Text = 
End Sub

Private Sub StatusBar1_MouseMove(Button As Integer, Shift As Integer, x_
   As Single, y As Single)
    StatusBar1.Panels(1).Text = This is the status bar used for _
   displaying text
End Sub
This code will display the correct text based on the position of the mouse. However, you can see that if an object doesn't have a MouseMove event coded, the text in the status bar will not be removed or changed. This would confuse the user as to the function of that object. Another drawback to this method is that it requires the user to move his eyes and refocus on the status bar at the bottom of the form. It was this reason that prompted the development of what was termed Balloon Help.
Balloon Help is the little yellow box that pops up when you leave the mouse on an object for a couple of seconds. However, programming tools like Visual Basic had no way to create them. Balloon Help, or ToolTips as they are now called, have become an integral part of the Visual Basic environment. Almost every object that you can place on a form has a ToolTipText property. Setting this property is the only action you must do in order to display information to the user about the object. Visual Basic does the rest of the work. Using the open project, remove the MouseMove routines and place the following code in the Form_Load routine:

 
< previous page page_198 next page >

If you like this book, buy it!